﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace WebApplication1.CinemaKnights
{
    public partial class SignUp : System.Web.UI.Page
    {

        SqlConnection cs = new SqlConnection(@"Data Source=.\SQLEXPRESS; Initial Catalog=CinemaKnights; Integrated Security=True");
        SqlDataAdapter da = new SqlDataAdapter();
        DataSet ds = new DataSet(); 

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSignUP_Click(object sender, EventArgs e)
        {
            da.InsertCommand = new SqlCommand("Insert into Student(StudentUsername,StudentPassword,Department,StudentNumber,StudentName,StudentCourse,StudentYear,StudentSection,StudentEmail) Values ('" + txtUsername.Text + "', '" + txtPassword.Text + "' , '" + ddlDepartment.Text + "' , '" + txtStudentNumber.Text + "' , '" + txtName.Text + "' , '" + txtCourse.Text + "' , '" + ddlYear.Text + "' , '" + txtSection.Text + "' , '" + txtEmail.Text + "')", cs);
            
            //da.InsertCommand.Parameters.Add("@StudentUsername", SqlDbType.NVarChar).Value = txtUsername.Text;
            //da.InsertCommand.Parameters.Add("@StudentPassword", SqlDbType.NVarChar).Value = txtPassword.Text;
            //da.InsertCommand.Parameters.Add("@Department", SqlDbType.NVarChar).Value = ddlDepartment.Text;
            //da.InsertCommand.Parameters.Add("@StudentNumber", SqlDbType.Float).Value = txtStudentNumber.Text;
            //da.InsertCommand.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = txtName.Text;
            //da.InsertCommand.Parameters.Add("@StudentCourse", SqlDbType.NVarChar).Value = txtCourse.Text;
            //da.InsertCommand.Parameters.Add("@StudentYear", SqlDbType.NVarChar).Value = ddlYear.Text;
            //da.InsertCommand.Parameters.Add("@StudentSection", SqlDbType.NVarChar).Value = txtSection.Text;
            //da.InsertCommand.Parameters.Add("@StudentEmail", SqlDbType.NVarChar).Value = txtEmail.Text;

            cs.Open();

            da.InsertCommand.ExecuteNonQuery();
            Response.Redirect("LogIn.aspx");
        }
    }
}